﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;
namespace PriceCuttingWar
{
    public class GamePlayCount
    {
        private static int MaxPlayCount = 10;
        /// <summary>
        /// 是否购买了
        /// </summary>
        public static bool IsTrialMode 
        {
            get
            {//需要引用Microsoft.Xna.Framework.GamerServices
#if !DEBUG
                return Microsoft.Xna.Framework.GamerServices.Guide.IsTrialMode;
#else
                return false;
#endif
            }
        }
        public static int Remainder
        {
            get 
            {
                int reaminder = MaxPlayCount;
                IsolatedStorageSettings storage = IsolatedStorageSettings.ApplicationSettings;
                if (storage.Contains("Remainder"))                
                    reaminder =(int) storage["Remainder"];
                else
                    storage.Add("Remainder", reaminder);
                return reaminder;
            }
            set
            {
                IsolatedStorageSettings storage = IsolatedStorageSettings.ApplicationSettings;
                if (storage.Contains("Remainder"))
                    storage["Remainder"] = value;
                else
                    storage.Add("Remainder", value);
            }
        }
    }
}
